Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve console output to show packet enum names (magic_enum) #1344

Merged
merged 45 commits into from
Dec 23, 2023

Conversation

jadebenn
Copy link
Collaborator

@jadebenn jadebenn commented Dec 20, 2023

Replaces #1340. Adds magic_enum as a dependency in order to enable enum reflection and display world and packet message enum strings in the server output.

@jadebenn jadebenn changed the title feat: Improve console output to show packet enum names (magic_enums method) feat: Improve console output to show packet enum names (magic_enum) Dec 20, 2023
@jadebenn
Copy link
Collaborator Author

Marking as draft because I had an epiphany about how to make the performance of our magic_enum implementation equal or exceed that of the preprocessor implementation. I will test this later, but here's the idea:

Instead of directly using the enum_name() function magic_enums provides, I will create a wrapper function called "StringifiedEnum" that defines a static const std::array provided by magic_enum's similarly-named enum_names() function. This function will then pass a reference to the corresponding array entry to the calling function. So, this should load a single copy of the pre-sorted(?) std::array into memory at compile-time, and it will be templated-out so those arrays are only generated for the enums this function is called on.

This should essentially eliminate any and all performance overhead magic_enums could possibly impose, as after compilation only an array of entries corresponding to the enum would exist, and a function to access it.

@jadebenn jadebenn marked this pull request as draft December 20, 2023 16:52
Copy link
Collaborator

@EmosewaMC EmosewaMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments that should be talked about; also is there anything more to adding a submodule others need to be aware of when updating dlu or is the README already taking care of this?

@jadebenn
Copy link
Collaborator Author

That's it for me. Ready to merge this when you all are.

aronwk-aaron
aronwk-aaron previously approved these changes Dec 23, 2023
Copy link
Collaborator

@EmosewaMC EmosewaMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more feedback

Copy link
Collaborator

@EmosewaMC EmosewaMC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some odd spacing on the edited else but im not going to block on it. Would recommend if you don't already alt+shift+f to format a file to the repo standard if it currently doesn't meet it (for vscode on windows at least this hotkey works)

@aronwk-aaron aronwk-aaron merged commit fcf4d6c into DarkflameUniverse:main Dec 23, 2023
3 checks passed
@jadebenn jadebenn deleted the ImproveConsoleOutputDep branch December 23, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants